package com.pet.controller.webUser;


import com.pet.dto.web.CheckResultDTO;
import com.pet.result.Result;
import com.pet.service.PetAdoptService;
import com.pet.service.UserInformationService;
import com.pet.vo.web.UserInformationVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
@Slf4j
public class UserHomeController {

    @Autowired
    private UserInformationService userInformationService;
    @Autowired
    private PetAdoptService petAdoptService;


    /**
     * 修改个人主页背景
     */
    @PutMapping("/homepageBackground")
    public Result homepageBackground(@RequestParam String imgUrl){
        log.info("修改个人主页背景:{}",imgUrl);
        userInformationService.updateHomepageBackground(imgUrl);
        return Result.success();
    }

    /**
     * 查询用户信息
     */
    @GetMapping("/selectUserInfo")
    public Result<UserInformationVO>selectUserInfo(@RequestParam(required = false) Integer userId){
        log.info("查询用户信息");

        return Result.success(userInformationService.selectUserInformation(userId));
    }

    /**
     * 删除个人送养
     */
    @DeleteMapping("/deleteUserAdopt")
    public Result deleteUserAdopt(@RequestParam Integer id){
        log.info("删除个人送养:{}",id);
        petAdoptService.deletePetAdoptInfo(id);
        return Result.success();
    }

    /**
     * 审核送养
     */
    @PutMapping("/checkUserAdopt")
    public Result checkUserAdopt(@RequestBody CheckResultDTO dto){
        log.info("checkUserAdopt:{}",dto);
        petAdoptService.checkUserAdopt(dto);
        return Result.success();
    }


    /**
     * 查询个人求助
     */

    /**
     * 删除个人求助
     */

    /**
     * 修改个人求助
     */

    /**
     * 查询个人发表的帖子
     */

    /**
     * 删除个人发表的帖子
     */

    /**
     * 修改个人发表的帖子
     */
}
